﻿// ***********************************************************************
// Assembly         : Common.OjbectPool
// Author           : xiaofu
// Created          : 12-30-2014
//
// Last Modified By : xiaofu
// Last Modified On : 12-30-2014
// ***********************************************************************
// <copyright file="PooledObjectState.cs" company="Microsoft">
//     Copyright (c) Microsoft. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

 
namespace Common.OjbectPool
{
    /// <summary>
    /// Provides the possible states that a <see cref="IPooledOjbect"/> may be in.
    /// </summary>
    public enum PooledObjectState
    {
      
        /// <summary>
        /// In the queue, not in use.
        /// </summary>
        IDLE,

        
        /// <summary>
        /// In use.
        /// </summary>
        ALLOCATED,

        
        /// <summary>
        ///In the queue, currently being tested for possible eviction.
        /// </summary>
        EVICTION,

       
        /// <summary>
        /// Not in the queue, currently being tested for possible eviction. An
        /// attempt to borrow the object was made while being tested which removed it
        /// from the queue. It should be returned to the head of the queue once
        /// eviction testing completes.
        /// TODO: Consider allocating object and ignoring the result of the eviction
        ///       test.
        /// </summary>
        EVICTION_RETURN_TO_HEAD,

    
        /// <summary>
        /// In the queue, currently being validated.
        /// </summary>
        VALIDATION,

        
        /// <summary>
        /// Not in queue, currently being validated. The object was borrowed while
        /// being validated and since testOnBorrow was configured, it was removed
        /// from the queue and pre-allocated. It should be allocated once validation
        /// completes.
        /// </summary>
        VALIDATION_PREALLOCATED,
 
        /// <summary>
        /// Not in queue, currently being validated. An attempt to borrow the object
        /// was made while previously being tested for eviction which removed it from
        /// the queue. It should be returned to the head of the queue once validation
        /// completes.
 
        /// </summary>
        VALIDATION_RETURN_TO_HEAD,

        
        /// <summary>
        ///  Failed maintenance (e.g. eviction test or validation) and will be / has been destroyed
        /// </summary>
        INVALID,
 
        /// <summary>
        /// Deemed abandoned, to be invalidated.
        /// </summary>
        ABANDONED,

         
        /// <summary>
        ///Returning to the pool.
        /// </summary>
        RETURNING
    }
}
